package com.goodwill.androidtest;

public class DateUtil {
    /**
     * @author Carol
     * 比较日期大小
     * @return
     */
    public static int compareDate(String date1, String date2){
        String d1 = date1.trim().replaceAll("-|:|/| ","");
        String d2 = date2.trim().replaceAll("-|:|/| ", "");
        StringBuilder sb1 = new StringBuilder(d1);
        StringBuilder sb2 = new StringBuilder(d2);
        while(sb1.length() < 14){
            sb1.append("0");
        }
        while(sb2.length() < 14){
            sb2.append("0");
        }
        long num1 = Long.parseLong(sb1.toString());
        long num2 = Long.parseLong(sb2.toString());
        return num1 == num2 ? 0 : num1 > num2 ? 1 : -1;
    }
}
